<?php

namespace app\api\validate;

use think\Validate;

class Express extends Validate
{
    protected $rule = [
        'company_name'=>'require|in:ZTO,STO,YTO,YD,JT,EMS',
        'company_code'=>'require|in:3,4,5,6,7,8',
        'pickup_code'=>'require|length:6,15',
        'tracking_number' => 'require|length:10,20|alphaNum',
        'address'        => 'require|max:100',
        'mobile' => 'require|mobile',
        'appt_type'      => 'number|in:0,1,2',
        'id'       => 'require|number|gt:0',
        'status'=>'require|number|in:2,3,4,5,6',
    ];

    protected $message = [
        'company_code'=>'快递公司错误',
        'pickup_code'=>'取件码有误',
        'tracking_number.require' => '快递单号不能为空',
        'tracking_number.length'  => '单号长度10-20位',
        'tracking_number.alphaNum'=> '单号只能包含字母和数字',
        'address.require' => '详细地址不能为空',
        'address.max' => '详细地址最多100个字符',
        'mobile.require' => '手机号不能为空',
        'mobile.mobile' => '手机号格式不正确',
        'appt_type'  => '类型不合法',
        'id.require'      => '快递必须为大于0的整数',
        'status.require'      => '状态值非法',
        'status.number'      => '状态值非法',
        'status.in'      => '状态值非法'
    ];

    protected $scene = [
        'create' => ['tracking_number','address','mobile','appt_type'],//预约快递
        'signIn' => ['id'], //签收快递状态
        'list'   => ['status'],
        'codeReserv' => ['company_name','company_code','pickup_code','address','mobile','appt_type'],
    ];
}